<?php
$type = $data['type'];
?>
<div class="block">
    <div class="block_head">
        <div class="bheadl"></div>
        <div class="bheadr"></div>
        <h2>Tạo Form</h2>
    </div>

    <div class="block_content">        
        <form action="<?php echo $this->createUrl('dashboard/createform') ?>" method="post">
            <?php
            $fields = trim($_GET['field']);
            $fields = str_replace('`', '', $fields);
            $fields = trim($fields, ',');
            $arrField = explode(',', $fields);

            $types = array('text', 'file', 'textarea', 'radio', 'checkbox', 'date', 'editor', 'combobox');


            foreach ($arrField as $f) {
                ?>                
                <p>                                
                    <label>Job type:</label><br />
                    <input type="text" class="text small" name="lables[]" value="" />
                    <input type="text" class="text small" name="fields[]" value="<?php echo $f; ?>" id="<?php echo $f; ?>" style="width: 100px;" />                
                    <select name="types[]" class="styled">
                        <?php
                        foreach ($types as $type) {
                            echo '<option value="' . $type . '">' . $type . '</option>';
                        }
                        ?>
                    </select>
                </p>            
                <?php
            }
            ?>
            <p>
                <input type="submit" class="submit small" value="Submit" />
                <input type="button" class="submit mid" value="Cancel" onclick="window.location='<?php echo $this->createUrl('type/index') ?>';" />
            </p>
        </form>
    </div>
    <div class="bendl"></div>
    <div class="bendr"></div>
</div>